package com.edu.study.base.stuCourseWordClean.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.edu.study.base.stuCourseWordClean.domain.StuCourseWordClean;
import com.edu.study.base.stuCourseWordClean.service.IStuCourseWordCleanService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 课程生词学习状态Controller
 * 
 * @author zw
 * @date 2022-04-13
 */
@RestController
@RequestMapping("/study/stuCourseWordClean")
public class StuCourseWordCleanController extends BaseController
{
    @Autowired
    private IStuCourseWordCleanService stuCourseWordCleanService;

    /**
     * 查询课程生词学习状态列表
     */
    @PreAuthorize("@ss.hasPermi('study:stuCourseWordClean:list')")
    @GetMapping("/list")
    public TableDataInfo list(StuCourseWordClean stuCourseWordClean)
    {
        startPage();
        List<StuCourseWordClean> list = stuCourseWordCleanService.selectStuCourseWordCleanList(stuCourseWordClean);
        return getDataTable(list);
    }

    /**
     * 导出课程生词学习状态列表
     */
    @PreAuthorize("@ss.hasPermi('study:stuCourseWordClean:export')")
    @Log(title = "课程生词学习状态", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(StuCourseWordClean stuCourseWordClean)
    {
        List<StuCourseWordClean> list = stuCourseWordCleanService.selectStuCourseWordCleanList(stuCourseWordClean);
        ExcelUtil<StuCourseWordClean> util = new ExcelUtil<StuCourseWordClean>(StuCourseWordClean.class);
        return util.exportExcel(list, "stuCourseWordClean");
    }

    /**
     * 获取课程生词学习状态详细信息
     */
    @PreAuthorize("@ss.hasPermi('study:stuCourseWordClean:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return AjaxResult.success(stuCourseWordCleanService.selectStuCourseWordCleanById(id));
    }

    /**
     * 新增课程生词学习状态
     */
    @PreAuthorize("@ss.hasPermi('study:stuCourseWordClean:add')")
    @Log(title = "课程生词学习状态", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody StuCourseWordClean stuCourseWordClean)
    {
        return toAjax(stuCourseWordCleanService.insertStuCourseWordClean(stuCourseWordClean));
    }

    /**
     * 修改课程生词学习状态
     */
    @PreAuthorize("@ss.hasPermi('study:stuCourseWordClean:edit')")
    @Log(title = "课程生词学习状态", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody StuCourseWordClean stuCourseWordClean)
    {
        return toAjax(stuCourseWordCleanService.updateStuCourseWordClean(stuCourseWordClean));
    }

    /**
     * 删除课程生词学习状态
     */
    @PreAuthorize("@ss.hasPermi('study:stuCourseWordClean:remove')")
    @Log(title = "课程生词学习状态", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(stuCourseWordCleanService.deleteStuCourseWordCleanByIds(ids));
    }
}
